package com.txm.qqserver.service;

import com.txm.qqcommon.Response;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.net.Socket;

public class QQServer extends Server {
    public QQServer() {
        super();
        while (true) {
            try {
                Thread.sleep(500);
//              等待客户端登录
                Socket accept = getServerSocket().accept();
                setAccept(accept);
                ObjectInputStream objectInputStream = new ObjectInputStream(getAccept().getInputStream());
                Response res = (Response) objectInputStream.readObject();
                setRes(res);
                this.method(res.getPath(), res.getObject());
            } catch (Exception e) {
//            throw new RuntimeException(e);
                System.out.println("QQServer Exception:" + e);
            }
        }
    }

    public void method(String path, Object obj) {
    }
}
